package com.hfuu.controller.check;

import com.github.pagehelper.PageInfo;
import com.hfuu.model.ResponseEntity;
import com.hfuu.model.ResponseEntityBuilder;
import com.hfuu.model.po.TbCheckRecord;
import com.hfuu.service.check.SchoolCheckService;
import com.hfuu.service.check.request.SchoolCheckRequest;
import com.hfuu.service.check.request.UpdateCheckRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.core.MediaType;

/**
 * 校方审核
 * Author: admin
 * Date: 2018/4/26
 * time: 上午10:03
 */
@RestController
@RequestMapping("/api/schoolCheck")
public class SchoolCheckController {

    @Autowired
    private SchoolCheckService schoolCheckService;

    /**
     * 获得审核列表
     *
     * @param request
     * @param
     * @return
     */
    @RequestMapping(value = "/listCheckData" , method = RequestMethod.POST , produces = MediaType.APPLICATION_JSON)
    @ResponseBody
    public ResponseEntity<PageInfo> listCheckData(@RequestBody SchoolCheckRequest request)
            throws Exception {
        return ResponseEntityBuilder.success(schoolCheckService.listCheckData(request));
    }
    /**
     * 获得审核详情信息
     *
     * @param request
     * @param
     * @return
     */
    @RequestMapping(value = "/getCheckDataDetail" , method = RequestMethod.POST , produces = MediaType.APPLICATION_JSON)
    @ResponseBody
    public ResponseEntity<TbCheckRecord> getCheckDataDetail(@RequestBody SchoolCheckRequest request)
            throws Exception {
        return ResponseEntityBuilder.success(schoolCheckService.getCheckDataDetail(request));
    }

    /**
     * 提交审核结果
     *
     * @param request
     * @param
     * @return
     */
    @RequestMapping(value = "/updateCheckData" , method = RequestMethod.POST , produces = MediaType.APPLICATION_JSON)
    @ResponseBody
    public ResponseEntity<Integer> updateCheckData(@RequestBody UpdateCheckRequest request)
            throws Exception {
        return ResponseEntityBuilder.success(schoolCheckService.updateCheckData(request));
    }
}
